<?php if(($sf_user->hasCredential("responsable")) || ($sf_user->hasCredential("livreur"))){?>
<h1>Liste de commandes</h1>

<div id="list">
	<table>
	  <thead>
	    <tr>
	      <th>Etat</th>
	      <th>Faite le</th>
	      <th>Depart</th>
	      <th>Client</th>
		  <th>Livreur</th>
		  <th></th>
	    </tr>
	  </thead>
	  <tbody>
	    <?php foreach ($commandes as $commande): 
	    	if($key % 2 == 0) {
	    		$style = "background-color: #A9CADD";
	    	} else {
	    		$style = "background-color: #E6F7FE";
	    	}	    
	    ?>
	    <tr style="<?php echo $style; ?>">
	      <td><?php echo $commande->getEtat() ?></td>
	      <td><?php echo $commande->getFaiteLe() ?></td>
	      <td><?php echo $commande->getDepart() ?></td>
	      <td><?php echo $commande->getUtilisateur_2() ?></td>
		  <td><?php echo $commande->getUtilisateur() ?></td>
		  <td>	      	
		  <?php if($sf_user->hasCredential('livreur')) {?>
	      	<a href="<?php echo url_for('commande/edit?id='.$commande->getId()) ?>"><img src="/images/edit.png" /> Livrer</a>
	      	<?php } ?>
		  </td>
	    </tr>
	    <?php endforeach; ?>
	  </tbody>
	</table>
</div>
<br />
<a href="<?php echo url_for('livreur/index') ?>">Retour</a>
<?php	}else{
	echo "Droits insuffisants.";
} ?>